package cl.mondo.praha.global;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class ConnectionDetector {
	private Context _context;

	public ConnectionDetector(Context context) {
		this._context = context;
	}
	
	public ConnectivityManager getConnectivityManager() {
		return (ConnectivityManager) _context.getSystemService(Context.CONNECTIVITY_SERVICE);
	}

	public Boolean isConnectingToInternet() {
		return getConnectivityManager().getActiveNetworkInfo() != null;
	}
	
	public NetworkInfo getActiveNetworkInfo() {
		return getConnectivityManager().getActiveNetworkInfo();
	}
	
	public NetworkInfo[] getAllNetworkInfo() {
		return getConnectivityManager().getAllNetworkInfo();
	}
}
